<template>
  <a-drawer
    width="32%"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32" style="width: 70%; margin-left: 15%">
          <a-col :span="12">
            <a-form-model-item label="姓名" prop="name">
              <a-input v-model="form.name" placeholder="请输入姓名" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="所属企业" prop="deptId">
              <a-tree-select
                v-model="form.deptId"
                placeholder="请选择所属单位"
                :tree-data="deptOptions"
                tree-default-expand-all
                :replaceFields="{
                  children: 'children',
                  title: 'title',
                  key: 'id',
                  value: 'id',
                }"
                @change="onTreeChange"
                allow-clear
              >
              </a-tree-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="性别" prop="sex">
              <a-select
                placeholder="选择性别"
                v-model="form.sex"
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in sexOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="出生日期" prop="birthday">
              <a-input
                v-model="form.birthday"
                placeholder="请输入出生日期"
                allow-clear
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="联系方式" prop="phone">
              <a-input
                v-model="form.phone"
                placeholder="请输入联系方式"
                allow-clear
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="政治面貌" prop="mianmao">
              <a-input
                v-model="form.mianmao"
                placeholder="请输入政治面貌"
                allow-clear
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="职务" prop="zhiwu">
              <a-input
                v-model="form.zhiwu"
                placeholder="请输入职务"
                allow-clear
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="籍贯" prop="jiguan">
              <a-input
                v-model="form.jiguan"
                placeholder="请输入籍贯"
                allow-clear
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button @click="cancel"> 取消 </a-button>
          <a-button type="primary" @click="submitForm"> 保存 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizPersonInfoEditForm from "./BizPersonInfoForm";
export default {
  ...BizPersonInfoEditForm,
};
</script>
